package com.example.wink_172_xg_test

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import com.tencent.android.tpush.XGPushConfig
import com.tencent.android.tpush.XGIOperateCallback

import com.tencent.android.tpush.XGPushManager


class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        init()
    }

    fun initView() {}

    fun init() {

        XGPushConfig.enableDebug(this, true);
//        XGPushConfig.setAccessId(this, 1500023405);
//        XGPushConfig.setAccessKey(this, "AZCPIA9C9X2V");
        XGPushManager.registerPush(this, object : XGIOperateCallback {
            override fun onSuccess(data: Any, flag: Int) {
                //token在设备卸载重装的时候有可能会变
                Log.e("TPush", "====>>注册成功，设备token为：$data")
            }

            override fun onFail(data: Any, errCode: Int, msg: String) {
                Log.e("TPush", "====>>注册失败，错误码：$errCode,错误信息：$msg")
            }
        })
    }

    private val TAG = "MainActivity"
}